package blockworld;

public class Direction 
{
	public static final int NORTH = 0;
	public static final int SOUTH = 1;
	public static final int EAST = 2;
	public static final int WEST = 3;
	
	public static String toString(int direction)
	{
		switch(direction)
		{
			case NORTH : return "north"; 
			case SOUTH : return "south"; 
			case EAST : return "east"; 
			case WEST : return "west";
			default : return "unrecognized direction";
		}
	}
	
	public static int fromString(String direction)
	{
		direction = direction.toLowerCase();
		
		if(direction.equals("north"))
			return NORTH;
		else if(direction.equals("south"))
			return SOUTH;
		else if(direction.equals("east"))
			return EAST;
		else if(direction.equals("west"))
			return WEST;
		else
			return -1;
	}
}
